package com.linkwedo.saas.project;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.interceptor.ServletRequestAware;

import com.linkwedo.saas.domain.Project;
import com.opensymphony.xwork2.ActionSupport;

public class LoadProjectAction extends ActionSupport implements ServletRequestAware{
	private static final long serialVersionUID = 8190003683775267839L;
	List<Project> list;
	private ProjectService projectService;
	
	public ProjectService getProjectService() {
		return projectService;
	}

	public void setProjectService(ProjectService projectService) {
		this.projectService = projectService;
	}
	public javax.servlet.http.HttpServletRequest getRequest() {
		return request;
	}

	public void setRequest(javax.servlet.http.HttpServletRequest request) {
		this.request = request;
	}

	private javax.servlet.http.HttpServletRequest request;

	public List<Project> getList() {
		return list;
	}

	public void setList(List<Project> list) {
		this.list = list;
	}


	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	
	public String execute() throws Exception {
	    String to = request.getParameter("to");
		//ProjectDao pdao=new ProjectDao();
		list=getProjectService().findAll();
		if(null != to){
			if(to.equalsIgnoreCase("addtarget")){
				return "addtarget";
			}
//			else if(to.equalsIgnoreCase("addtask")){
//				return "addtask";
//			}
		}
	    return "SUCCESS";
	}

	@Override
	public void setServletRequest(HttpServletRequest arg0) {
		// TODO Auto-generated method stub
		this.request = arg0;
		
	}
}
